package com.sensePlusVR.widget.refresh;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

import com.sensePlusVR.main.R;

public class RefreshHeaderView extends TextView implements SwipeRefreshTrigger, SwipeTrigger {

	public RefreshHeaderView(Context context) {
        super(context);
    }

    public RefreshHeaderView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public void onRefresh() {
    	setTextColor(getResources().getColor(R.color.app_text_color_gray1));
    	//setTextSize(getResources().getDimension(R.dimen.text_font_size_large2));
        setText(R.string.refreshing);
    }

    @Override
    public void onPrepare() {
        setText("");
    }

    @Override
    public void onMove(int yScrolled, boolean isComplete, boolean automatic) {
    	setTextColor(getResources().getColor(R.color.app_text_color_gray1));
    	//setTextSize(getResources().getDimension(R.dimen.text_font_size_large2));
        if (!isComplete) {
            if (yScrolled >= getHeight()) {
                setText(R.string.release_to_refresh);
            } else {
                setText(R.string.swipe_to_refresh);
            }
        } else {
            setText(R.string.refresh_returning);
        }
    }

    @Override
    public void onRelease() {
    }

    @Override
    public void onComplete() {
    	setTextColor(getResources().getColor(R.color.app_text_color_gray1));
    	//setTextSize(getResources().getDimension(R.dimen.text_font_size_large2));
        setText(R.string.complete);
    }

    @Override
    public void onReset() {
        setText("");
    }
    
}
